<html>
<body>
<p>报告 <a href="https://www.python.org/dev/peps/pep-0544/">PEP-544</a> 中引入的协议的无效定义和用法。</p>
<p><b>示例：</b></p>
<pre><code>
from typing import Protocol


class MyProtocol(Protocol):
    def method(self, p: int) -> str:
        pass


class MyClass(MyProtocol):
    def method(self, p: str) -> int: # 'method' 的类型不兼容 'MyProtocol'
        pass


class MyAnotherProtocol(MyClass, Protocol): # 协议的所有基础必须为协议
    pass

</code></pre>
</body>
</html>